<include file="Public/header"/>
<include file="Public/menu"/>
<style>
    .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
        vertical-align:middle;
    }
</style>
<!-- 内容页 -->
<div class="content-wrapper">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            全国送
            <small>抽佣</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="/"><i class="fa fa-dashboard"></i> 全国送-店铺抽佣结算账单</a></li>
            <li class="active">编辑页</li>
        </ol>
    </section>

    <!-- 内容 -->
    <section class="content">

        <div class="tab-content">
            <div class="tab-pane active" id="tab_0">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title">{$info.local_name}--{$info.start_time|date='Y-m-d',###}~{$info.end_time|date='Y-m-d',###}</h3>
                    </div>
                    <form action="{:U('QgsBills/saveEdit')}" method="post" onSubmit="return checkSettleSubmit();">
                        <if condition="$order neq ''">
                            <div class="box-header" style="background-color: #fbed50">
                                <h3 class="box-title">结算明细</h3>
                            </div>
                            <div class="box-body table-responsive no-padding">
                                <table class="table table-hover" id="order-table-list">
                                    <tbody>
                                    <tr>
                                        <th>ID</th>
                                        <th>订单号</th>
                                        <th>商品</th>
                                        <th>佣金率</th>
                                        <th>抽佣金额</th>
                                        <!--<th>门店优惠</th>
                                        <th>物流费用</th>-->
                                        <th>订单金额</th>
                                        <th>实支付金额</th>
                                        <th>完成日期</th>
                                        <th>支付方式</th>
                                        <th>会员昵称</th>
                                        <th>收货人</th>
                                        <th>操作</th>
                                    </tr>
                                    <volist name="order" id="vo" key="key">
                                        <tr class="one-order-area">
                                        	<td>{$key}</td>
                                            <td>
                                                <a href="{:U('orders/orderDetail',array('id'=>$vo['order_id']))}">{$vo.order_id}</a>
                                                 <input type="hidden" name="order[]" value="{$vo.order_id}">
                                            </td>                                         
                                            <if condition="$vo['geshu'] gt 1">
                                                <td>
                                                    <table>
                                                        <volist name="vo['list']" id="v">
                                                            <tr>
                                                                <td>{$v.name}</td>
                                                            </tr>
                                                        </volist>
                                                    </table>
                                                </td>
                                                <td>
                                                    <table>
                                                        <volist name="vo['list']" id="v">
                                                            <tr>
                                                                <td>{$v.yc_rate}%</td>
                                                            </tr>
                                                        </volist>
                                                    </table>
                                                </td>
                                                <td>
                                                    <table>
                                                        <volist name="vo['list']" id="v">
                                                            <tr>
                                                                <td>{$v.yc_fee}</td>
                                                            </tr>
                                                        </volist>
                                                    </table>
                                                </td>

                                           <else />
                                                <td>{$vo['list'][0]['name']}</td>
                                                <td>{$vo['list'][0]['yc_rate']}%</td>
                                                <td>{$vo['list'][0]['yc_fee']}</td>
                                            </if>
                                            <td>{$vo.cost_item}</td>
                                            <td class="grid-order" data-yjfee="{$vo.yongjin|default=0}" data-cost="{$vo['total_amount']}">{$vo['total_amount']}</td>
                                            <td>{$vo.createtime|date='Y-m-d H:i:s', ###}</td>
                                            <td>{$vo.paymethod_name|default='-'}</td>
                                            <td>{$vo.nickname}</td>
                                            <td>{$vo.ship_name}</td>
                                            <td>
                                                <a href="javascript:void(0);" data-id="{$key}" class="grid-delete">移除</a>
                                            </td>
                                        </tr>
                                    </volist>
                                    </tbody>
                                </table>
                            </div>
                            <div class="box-header" style="background:#ccc">
                                <h3 class="box-title">共计</h3>
                            </div>
                            <div class="box-body table-responsive no-padding" style="width:50%;">
                                <table class="table table-hover">
                                    <tbody>
                                    <tr>
                                        <th>订单数量</th>
                                        <th>抽佣总额</th>
                                        <th>银行手续费</th>
                                        <th>其他手续费</th>
                                        <th>应结算总金额</th>
                                    </tr>
                                    <tr>
                                        <td><span id="zj-order-num">{$info.order_num}</span></td>
                                        <td><span id="zj-order-totalyj">{$info.order_commission}</span></td>
                                        <td><input id="zj-order-bank" data-key="order-bank" name="bank" type="text" class="form-control" value="{$info.order_bank}"></td>
                                        <td><input id="zj-order-other" data-key="order-other" name="other" type="text" class="form-control" value="{$info.order_other}"></td>
                                        <td><span id="zj-order-finalfee">正在计算...</span></td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div>公式 ： 应结算金额 =  抽佣总额   - 银行手续费 - 其他手续费</div>
                            <div style="height: 100px;"></div>
                        </if>

                        <if condition="$order neq '' or $refund neq ''">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="box-body">
                                        <div class="form-group">
                                            <label for="inputEmail3" class="col-sm-2 control-label">经办人</label>
                                            <div class="col-sm-10">
                                                <input type="text" class="form-control" id="inputEmail3" name="handle_name" value="{$info.handle_name}" placeholder="经办人" readonly>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="" class="col-sm-2 control-label">备注</label>

                                            <div class="col-sm-10">
                                                <textarea class="form-control" rows="3" placeholder="备注" name="handle_tips">{$info.remark}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div><strong>本次结算实际金额:</strong><label class="label label-danger" style="font-size:15px;" id="current-js-fianlfee">正在计算...</label></div>
                                </div>
                            </div>
                            <if condition="$info['money_img'] neq ''">
                            <div class="row">
                                <img src="{'/Public/'.$info['money_img']}" alt="">
                            </div>
                            </if>
                            <div>
                                <input type="hidden" name="id" value="{$_GET['id']}">
                                <button class="btn btn-primary btn-lg" type="submit">保存</button>
                            </div>
                        </if>
                    </form>
                    <div class="blank"></div>
                    <if condition="$info['money_img'] neq ''">
                        <div class="box-body table-responsive no-padding">
                            <div class="yellowtop" style="padding: 8px;">付款信息</div>
                            <div style="text-align: center;">
                                <img src="/Uploads/{$info['money_img']}" alt="">
                            </div>
                        </div>
                    </if>
                    <div class="box-footer clearfix">
                        <if condition="$info['state'] eq 0">
                            <!--<a class="btn btn-sm btn-success queren" data-id="{$_GET['id']}" data-state="1">对账确认</a>-->
                            <elseif condition="$info['state'] eq 2" />
                            <a class="btn btn-sm btn-primary yc-yy-operate" data-id="{$_GET['id']}" data-state="1">查看异议</a>
                            <else />
                            <a class="btn btn-sm btn-success" data-id="{$_GET['id']}" data-state="1">交易成功</a>
                        </if>
                    </div>
                </div>
            </div>

        </div>
    </section>
</div>
<div class="modal fade" id="myYYModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">
                    结算异议
                </h4>
            </div>
            <form role="form" id="yy-form-mark" onSubmit="return false;">
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <div>
                                    <label>备注</label>
                                    <textarea class="form-control" rows="2" id="yy_desc" placeholder="添加备注" name="desc"></textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <div>
                                    <label for="">异议联系人</label>
                                    <input id="yy_name" type="text" class="form-control" name="name" value="">
                                </div>
                            </div>
                            <div class="form-group">
                                <div>
                                    <label>联系电话</label>
                                    <input id="yy_tel" type="text" class="form-control" name="tel" value="">
                                    <input id="yy_id" type="hidden" name="id" value="{$_GET['id']}">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6" style="height: 240px;overflow-y: scroll;overflow-x: hidden;">
                            <div class="form-group">
                                <label>反馈区</label>
                                <div id="commentarea"></div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        关闭
                    </button>
                    <button type="submit" class="btn btn-primary">
                        提交
                    </button>
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- 底部 -->
<include file="Public/common_footer"/>
<script src="/Public/layer/layer.js"></script>
<script type="text/javascript" src="/Public/admin/js/com.bill.yy.js"></script>
<script type="text/javascript">
	yc_yy_url = "{:U('Bills/sendyiyi')}";    
	var list = <php> echo $info['talk'] ? $info['talk'] : "''";</php>;
	renderYYList(list);	
</script>
<script type="text/javascript" src="/Public/admin/js/qgs.bill.js.js"></script>